<template>
   <div class="app-container">
      <!-- 页面头部 -->
      <div class="page-header">
         <el-card class="header-card" shadow="never">
            <div class="header-content">
               <div class="header-left">
                  <div class="header-icon">
                     <el-icon><ChatDotRound /></el-icon>
                  </div>
                  <div class="header-info">
                     <h1>帖子管理</h1>
                     <p>管理社团帖子的发布、编辑和审核</p>
                  </div>
               </div>
               <div class="header-stats">
                  <el-icon class="stats-icon"><Document /></el-icon>
                  <span class="stats-text">总帖子数: {{ total }}</span>
               </div>
            </div>
         </el-card>
      </div>

      <!-- 搜索区域 -->
      <div class="search-container" v-show="showSearch">
         <el-card class="search-card" shadow="never">
            <el-form :model="queryParams" ref="queryRef" class="search-form">
               <el-row :gutter="20">
                  <el-col :span="6">
                     <el-form-item label="帖子标题" prop="title">
                        <el-input
                           v-model="queryParams.title"
                           placeholder="请输入帖子标题"
                           clearable
                           prefix-icon="Search"
                           @keyup.enter="handleQuery"
                        />
                     </el-form-item>
                  </el-col>
                  <el-col :span="6">
                     <el-form-item label="社团名称" prop="clubName">
                        <el-input
                           v-model="queryParams.clubName"
                           placeholder="请输入社团名称"
                           clearable
                           prefix-icon="OfficeBuilding"
                           @keyup.enter="handleQuery"
                        />
                     </el-form-item>
                  </el-col>
                  <el-col :span="6">
                     <el-form-item label="帖子状态" prop="status">
                        <el-select v-model="queryParams.status" placeholder="请选择帖子状态" clearable>
                           <el-option
                              v-for="dict in post_status"
                              :key="dict.value"
                              :label="dict.label"
                              :value="dict.value"
                           />
                        </el-select>
                     </el-form-item>
                  </el-col>
                  <el-col :span="6">
                     <el-form-item>
                        <div class="search-buttons">
                           <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
                           <el-button icon="Refresh" @click="resetQuery">重置</el-button>
                        </div>
                     </el-form-item>
                  </el-col>
               </el-row>
            </el-form>
         </el-card>
      </div>

      <!-- 操作按钮区域 -->
      <div class="action-container">
         <el-card class="action-card" shadow="never">
            <div class="action-content">
               <div class="action-buttons">
                  <el-button
                     type="primary"
                     class="action-btn primary-btn"
                     icon="Plus"
                     @click="handleAdd"
                     v-hasPermi="['system:post:add']"
                  >发布帖子</el-button>
                  <el-button
                     type="warning"
                     class="action-btn"
                     icon="Edit"
                     :disabled="single"
                     @click="handleUpdate"
                     v-hasPermi="['system:post:edit']"
                  >编辑</el-button>
                  <el-button
                     type="danger"
                     class="action-btn"
                     icon="Delete"
                     :disabled="multiple"
                     @click="handleDelete"
                     v-hasPermi="['system:post:remove']"
                  >批量删除</el-button>
               </div>
               <div class="toolbar-container">
                  <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
               </div>
            </div>
         </el-card>
      </div>

      <!-- 帖子列表 -->
      <div class="table-container">
         <el-card class="table-card" shadow="never">
            <el-table 
               v-loading="loading" 
               :data="postList" 
               @selection-change="handleSelectionChange"
               class="modern-table"
               header-row-class-name="table-header"
            >
               <el-table-column type="selection" width="55" align="center" />
               
               <!-- 帖子信息 -->
               <el-table-column label="帖子信息" min-width="350">
                  <template #default="scope">
                     <div class="post-info">
                        <div class="post-header">
                           <el-icon class="post-icon"><ChatDotRound /></el-icon>
                           <span class="post-title">{{ scope.row.title }}</span>
                           <el-tag v-if="scope.row.isTop" type="danger" size="small" class="top-tag">
                              <el-icon><Top /></el-icon>
                              置顶
                           </el-tag>
                        </div>
                        <div class="post-meta">
                           <span class="meta-item">
                              <el-icon><User /></el-icon>
                              作者: {{ scope.row.authorName }}
                           </span>
                           <span class="meta-item">
                              <el-icon><OfficeBuilding /></el-icon>
                              社团: {{ scope.row.clubName }}
                           </span>
                        </div>
                     </div>
                  </template>
               </el-table-column>

               <!-- 状态信息 -->
               <el-table-column label="状态" align="center" width="120">
                  <template #default="scope">
                     <div class="status-info">
                        <dict-tag :options="post_status" :value="String(scope.row.status)" />
                     </div>
                  </template>
               </el-table-column>

               <!-- 统计信息 -->
               <el-table-column label="统计信息" align="center" width="200">
                  <template #default="scope">
                     <div class="stats-info">
                        <div class="stats-item">
                           <el-icon class="stats-icon"><View /></el-icon>
                           <span class="stats-label">浏览:</span>
                           <span class="stats-value">{{ scope.row.viewCount }}</span>
                        </div>
                        <div class="stats-item">
                           <el-icon class="stats-icon"><ChatDotRound /></el-icon>
                           <span class="stats-label">评论:</span>
                           <span class="stats-value">{{ scope.row.commentCount }}</span>
                        </div>
                        <div class="stats-item">
                           <el-icon class="stats-icon"><Star /></el-icon>
                           <span class="stats-label">点赞:</span>
                           <span class="stats-value">{{ scope.row.likeCount }}</span>
                        </div>
                     </div>
                  </template>
               </el-table-column>

               <!-- 时间信息 -->
               <el-table-column label="发布时间" align="center" width="180">
                  <template #default="scope">
                     <div class="time-info">
                        <div class="time-item">
                           <el-icon class="time-icon"><Calendar /></el-icon>
                           <span class="time-value">{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
                        </div>
                        <div class="time-item">
                           <el-icon class="time-icon"><Clock /></el-icon>
                           <span class="time-value">{{ parseTime(scope.row.createdAt, '{h}:{i}') }}</span>
                        </div>
                     </div>
                  </template>
               </el-table-column>

               <!-- 操作列 -->
               <el-table-column label="操作" width="200" align="center">
                  <template #default="scope">
                     <div class="action-buttons">
                        <el-button 
                           type="primary" 
                           size="small" 
                           icon="View" 
                           @click="handleView(scope.row)" 
                           v-hasPermi="['system:post:query']"
                           class="table-action-btn"
                        >查看</el-button>
                        <el-button 
                           type="success" 
                           size="small" 
                           icon="ChatDotRound" 
                           @click="handleComment(scope.row)" 
                           v-hasPermi="['system:post:comment']"
                           class="table-action-btn"
                        >评论</el-button>
                        <el-button 
                           type="warning" 
                           size="small" 
                           icon="Edit" 
                           @click="handleUpdate(scope.row)" 
                           v-hasPermi="['system:post:edit']"
                           class="table-action-btn"
                        >编辑</el-button>
                        <el-button 
                           type="danger" 
                           size="small" 
                           icon="Delete" 
                           @click="handleDelete(scope.row)" 
                           v-hasPermi="['system:post:remove']"
                           class="table-action-btn"
                        >删除</el-button>
                     </div>
                  </template>
               </el-table-column>
            </el-table>
         </el-card>
      </div>

      <pagination
         v-show="total > 0"
         :total="total"
         v-model:page="queryParams.pageNum"
         v-model:limit="queryParams.pageSize"
         @pagination="getList"
      />

      <!-- 发帖对话框 -->
      <el-dialog :title="title" v-model="open" width="800px" append-to-body>
         <el-form ref="postRef" :model="form" :rules="rules" label-width="100px">
            <el-form-item label="选择社团" prop="clubName">
               <el-select v-model="form.clubId" placeholder="请选择社团" style="width: 100%" @change="handleClubChange">
                  <el-option
                     v-for="club in userClubs"
                     :key="club.clubName"
                     :label="club.clubName"
                     :value="club.clubId"
                  />
               </el-select>
            </el-form-item>
            <el-form-item label="帖子标题" prop="title">
               <el-input v-model="form.title" placeholder="请输入帖子标题" />
            </el-form-item>
            <el-form-item label="帖子内容" prop="content">
               <el-input 
                  v-model="form.content" 
                  type="textarea" 
                  placeholder="请输入帖子内容" 
                  :rows="8"
                  show-word-limit
                  maxlength="2000"
               />
            </el-form-item>
            <!-- <el-form-item label="帖子类型" prop="type">
               <el-radio-group v-model="form.type">
                  <el-radio :label="1">普通帖子</el-radio>
                  <el-radio :label="2">公告</el-radio>
                  <el-radio :label="3">活动</el-radio>
               </el-radio-group>
            </el-form-item> -->
            <el-form-item label="是否置顶" prop="isTop">
               <el-switch v-model="form.isTop" />
            </el-form-item>
         </el-form>
         <template #footer>
            <div class="dialog-footer">
               <el-button type="primary" @click="submitForm">发布</el-button>
               <el-button @click="cancel">取 消</el-button>
            </div>
         </template>
      </el-dialog>

      <!-- 帖子详情对话框 -->
      <el-dialog title="帖子详情" v-model="viewOpen" width="900px" append-to-body>
         <div v-if="selectedPost" class="post-detail">
            <!-- 帖子内容 -->
            <div class="post-header">
               <h2>{{ selectedPost.title }}</h2>
               <div class="post-meta">
                  <span>作者：{{ selectedPost.authorName }}</span>
                  <span>社团：{{ selectedPost.clubName }}</span>
                  <span>发布时间：{{ parseTime(selectedPost.createdAt) }}</span>
                  <span>浏览量：{{ selectedPost.viewCount }}</span>
                  <!-- <span>评论数：{{ selectedPost.commentCount }}</span> -->
                  <span>点赞数：{{ selectedPost.likeCount }}</span>
                  
               </div>

            </div>
            
            <div class="post-content">
               <p>{{ selectedPost.content }}</p>
               
            </div>
            <div class="comment-actions">
               <el-button link type="primary" size="small" @click="likePost(selectedPost.id)">
                  <el-icon><Star /></el-icon>
                  点赞 ({{ selectedPost.likeCount }})
               </el-button>
            </div>
            
            <!-- 评论区 -->
            <div class="comment-section">
               <h3>评论区</h3>
               <!-- 发表评论 -->
               <div class="comment-form">
                  <el-input
                     v-model="commentForm.content"
                     type="textarea"
                     placeholder="写下你的评论..."
                     :rows="3"
                     maxlength="500"
                     show-word-limit
                  />
                  <el-button type="primary" @click="submitComment" style="margin-top: 10px;">发表评论</el-button>
               </div>
               
               <!-- 评论列表 -->
               <div class="comment-list">
                  <div v-for="comment in commentList" :key="comment.id" class="comment-item">
                     <div class="comment-header">
                        <span class="comment-author">{{ comment.authorName }}</span>
                        <span class="comment-time">{{ parseTime(comment.createdAt) }}</span>
                     </div>
                     <div class="comment-content">
                        {{ comment.content }}
                     </div>
                     <div class="comment-actions">
                        <el-button link type="primary" size="small" @click="likeComment(comment.id)">
                           <el-icon><Star /></el-icon>
                           点赞 ({{ comment.likeCount }})
                        </el-button>
                        <el-button link type="primary" size="small" @click="replyComment(comment)">
                           回复
                        </el-button>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </el-dialog>
   </div>
</template>

<script setup name="Post">
import { ref, reactive, toRefs, getCurrentInstance } from 'vue'
import { Star, ChatDotRound, Document, Search, Refresh, Plus, Edit, Delete, Download, User, OfficeBuilding, Check, Close, Calendar, Clock, View } from '@element-plus/icons-vue'
import { listPost, getPost, addPost, updatePost, delPost, listUserClubs, listComments, addComment, likeComment as likeCommentApi,  likePost as likePostApi} from "@/api/system/post";
const { proxy } = getCurrentInstance();
const { post_status } = proxy.useDict("post_status");

const postList = ref([]);
const open = ref(false);
const viewOpen = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const selectedPost = ref(null);
const commentList = ref([]);
const userClubs = ref([]);

const data = reactive({
  form: {
    id: undefined,
    clubId: undefined,
    title: undefined,
    content: undefined,
    type: 1,
    isTop: false
  },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    clubName: undefined,
    title: undefined,
    authorName: undefined,
    status: undefined
  },
  rules: {
    clubId: [
      { required: true, message: "请选择社团", trigger: "change" }
    ],
    title: [
      { required: true, message: "帖子标题不能为空", trigger: "blur" }
    ],
    content: [
      { required: true, message: "帖子内容不能为空", trigger: "blur" }
    ],
    type: [
      { required: true, message: "请选择帖子类型", trigger: "change" }
    ]
  },
  commentForm: {
    content: "",
    postId: null,
    parentId: null
  }
});

const { queryParams, form, rules, commentForm } = toRefs(data);

/** 查询帖子列表 */
function getList() {
  loading.value = true;
  listPost(queryParams.value).then(response => {
    postList.value = response.rows || [];
    total.value = response.total || 0;
    loading.value = false;
  }).catch(error => {
    console.error('获取帖子列表失败:', error);
    loading.value = false;
  });
}

/** 获取用户可发帖的社团列表 */
function getUserClubs() {
  listUserClubs().then(response => {
    userClubs.value = response.data || [];
  }).catch(error => {
    console.error('获取用户社团列表失败:', error);
    userClubs.value = [];
  });
}

/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}

/** 表单重置 */
function reset() {
  form.value = {
    id: undefined,
    clubId: undefined,
    title: undefined,
    content: undefined,
    type: 1,
    isTop: false
  };
  proxy.resetForm("postRef");
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

/** 多选框选中数据 */
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.id);
  single.value = selection.length !== 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
function handleAdd() {
  reset();
  getUserClubs();
  open.value = true;
  title.value = "发布新帖子";
}

/** 修改按钮操作 */
function handleUpdate(row) {
  reset();
  getUserClubs();
  const id = row.id || ids.value;
  getPost(id).then(response => {
    form.value = response.data;
    open.value = true;
    title.value = "编辑帖子";
  }).catch(error => {
    console.error('获取帖子详情失败:', error);
    proxy.$modal.msgError("获取帖子详情失败");
  });
}

/** 查看按钮操作 */
function handleView(row) {
  const id = row.id || ids.value;
  getPost(id).then(response => {
    selectedPost.value = response.data || {};
    commentForm.value.postId = id;
    viewOpen.value = true;
    getCommentList(id);
  }).catch(error => {
    console.error('获取帖子详情失败:', error);
    proxy.$modal.msgError("获取帖子详情失败");
  });
}

/** 评论按钮操作 */
function handleComment(row) {
  handleView(row);
}

/** 获取评论列表 */
function getCommentList(postId) {
  listComments({ postId: postId }).then(response => {
    commentList.value = response.rows || [];
  }).catch(error => {
    console.error('获取评论列表失败:', error);
    commentList.value = [];
  });
}

/** 提交评论 */
function submitComment() {
  if (!commentForm.value.content.trim()) {
    proxy.$modal.msgError("请输入评论内容");
    return;
  }
  
  addComment(commentForm.value).then(response => {
    proxy.$modal.msgSuccess("评论发表成功");
    commentForm.value.content = "";
    getCommentList(commentForm.value.postId);
  }).catch(error => {
    proxy.$modal.msgError("评论发表失败：" + (error.message || '未知错误'));
  });
}

/** 点赞评论 */
function likeComment(commentId) {
  likeCommentApi(commentId).then(response => {
    proxy.$modal.msgSuccess("点赞成功");
    getCommentList(commentForm.value.postId);
  }).catch(error => {
    proxy.$modal.msgError("点赞失败：" + (error.message || '未知错误'));
  });
}

/** 点赞帖子 */
function likePost(id) {
  likePostApi(id).then(response => {
    proxy.$modal.msgSuccess("点赞成功");
  getPost(id).then(response => {
    selectedPost.value = response.data || {};
    commentForm.value.postId = id;
    viewOpen.value = true;
    getCommentList(id);
  }).catch(error => {
    console.error('获取帖子详情失败:', error);
    proxy.$modal.msgError("获取帖子详情失败");
  });
  }).catch(error => {
    proxy.$modal.msgError("点赞失败：" + (error.message || '未知错误'));
  });
}

/** 回复评论 */
function replyComment(comment) {
  commentForm.value.content = `@${comment.authorName} `;
  commentForm.value.parentId = comment.id;
}

/** 社团选择变化 */
function handleClubChange(clubId) {
  // 可以在这里添加社团相关的逻辑
}

/** 提交按钮 */
function submitForm() {
  proxy.$refs["postRef"].validate(valid => {
    if (valid) {
      if (form.value.id != null) {
        updatePost(form.value).then(response => {
          proxy.$modal.msgSuccess("修改成功");
          open.value = false;
          getList();
        }).catch(error => {
          proxy.$modal.msgError("修改失败：" + (error.message || '未知错误'));
        });
      } else {
        addPost(form.value).then(response => {
          proxy.$modal.msgSuccess("发布成功");
          open.value = false;
          getList();
        }).catch(error => {
          proxy.$modal.msgError("发布失败：" + (error.message || '未知错误'));
        });
      }
    }
  });
}

/** 删除按钮操作 */
function handleDelete(row) {
  const postIds = row.id || ids.value;
  proxy.$modal.confirm('是否确认删除帖子ID为"' + postIds + '"的数据项？').then(function() {
    return delPost(postIds);
  }).then(() => {
    getList();
    proxy.$modal.msgSuccess("删除成功");
  }).catch(() => {});
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download("system/post/export", {
    ...queryParams.value
  }, `post_${new Date().getTime()}.xlsx`);
}

getList();
</script>

<style lang="scss" scoped>
// 页面整体样式
.app-container {
  background: transparent;
  min-height: 100vh;
  padding: 20px;
}

// 头部样式
.page-header {
  background: transparent;
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
  
  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    .header-left {
      display: flex;
      align-items: center;
      gap: 16px;
      
      .header-icon {
        width: 48px;
        height: 48px;
        background: transparent;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 24px;
      }
      
      .header-text {
        h1 {
          margin: 0;
          font-size: 28px;
          font-weight: 700;
          background: transparent;
        
          -webkit-text-fill-color: transparent;
        
        }
        
        p {
          margin: 4px 0 0 0;
          color: #666;
          font-size: 14px;
        }
        
        // 工具栏容器样式
        .toolbar-container {
          display: flex;
          align-items: center;
          margin-left: 16px;
        }
      }
    }
    
    .header-stats {
      display: flex;
      align-items: center;
      gap: 24px;
      
      .stat-item {
        text-align: center;
        
        .stat-number {
          font-size: 24px;
          font-weight: 700;
          color: #667eea;
          display: block;
        }
        
        .stat-label {
          font-size: 12px;
          color: #999;
          margin-top: 4px;
        }
      }
    }
  }
}

// 搜索区域样式
.search-card {
  background: transparent;
  backdrop-filter: blur(10px);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
  overflow: hidden;
  
  :deep(.el-card__body) {
    padding: 24px;
  }
  
  .search-form {
    :deep(.el-form-item) {
      margin-bottom: 16px;
      
      .el-form-item__label {
        font-weight: 600;
        color: #333;
      }
      
      .el-input {
        .el-input__wrapper {
          border-radius: 8px;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
          transition: all 0.3s ease;
          
          &:hover {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
          }
          
          &.is-focus {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
          }
        }
      }
      
      .el-select {
        width: 100%;
        
        .el-input__wrapper {
          border-radius: 8px;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
          transition: all 0.3s ease;
          
          &:hover {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
          }
        }
      }
    }
    
    .search-buttons {
      display: flex;
      gap: 12px;
      justify-content: flex-end;
      margin-top: 16px;
      
      .el-button {
        border-radius: 8px;
        padding: 10px 20px;
        font-weight: 600;
        transition: all 0.3s ease;
        
        &.el-button--primary {
          background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
          border: none;
          color: white;
          
          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
            background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
          }
        }
        
        &.el-button--default {
          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
          }
        }
      }
    }
  }
}

// 操作按钮样式
.action-card {
  background: transparent;
  backdrop-filter: blur(10px);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  
  :deep(.el-card__body) {
    padding: 20px 24px;
  }
  
  .action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    
    .action-btn {
      border-radius: 10px;
      padding: 12px 24px;
      font-weight: 600;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      gap: 8px;
      
      &.primary-btn {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        
        &:hover {
          transform: translateY(-3px);
          box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
          background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
        }
      }
      
      &.success-btn {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        border: none;
        color: white;
        
        &:hover {
          transform: translateY(-3px);
          box-shadow: 0 10px 30px rgba(79, 172, 254, 0.4);
          background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
        }
      }
      
      &.danger-btn {
        background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
        border: none;
        color: white;
        
        &:hover {
          transform: translateY(-3px);
          box-shadow: 0 10px 30px rgba(250, 112, 154, 0.4);
          background: linear-gradient(135deg, #fee140 0%, #fa709a 100%);
        }
      }
      
      &.info-btn {
        background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
        border: none;
        color: #333;
        
        &:hover {
          transform: translateY(-3px);
          box-shadow: 0 10px 30px rgba(168, 237, 234, 0.4);
          background: linear-gradient(135deg, #fed6e3 0%, #a8edea 100%);
        }
      }
    }
  }
}

// 表格样式
.table-card {
  background: transparent;
  backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  
  :deep(.el-card__body) {
    padding: 0;
  }
  
  :deep(.el-table) {
    background: transparent;
    
    .el-table__header {
      th {
        background: transparent;
        color: #333;
        font-weight: 700;
        border: none;
        padding: 16px 12px;
        
        .cell {
          display: flex;
          align-items: center;
          gap: 8px;
        }
      }
    }
    
    .el-table__body {
      tr {
        transition: all 0.3s ease;
        
        &:hover {
          background: transparent;
          transform: scale(1.01);
        }
        
        td {
          border: none;
          padding: 16px 12px;
          
          .cell {
            display: flex;
            align-items: center;
            gap: 8px;
          }
        }
      }
    }
  }
  
  // 帖子信息样式
  .post-info {
    .post-title {
      font-weight: 600;
      color: #333;
      margin-bottom: 4px;
      font-size: 16px;
    }
    
    .post-meta {
      display: flex;
      gap: 12px;
      font-size: 12px;
      color: #666;
      
      .meta-item {
        display: flex;
        align-items: center;
        gap: 4px;
        
        .el-icon {
          font-size: 14px;
        }
      }
    }
  }
  
  // 状态样式
  .status-info {
    .status-badge {
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 600;
      
      &.status-published {
        background: transparent;
        color: white;
      }
      
      &.status-draft {
        background: transparent;
        color: #333;
      }
      
      &.status-hidden {
        background: transparent;
        color: white;
      }
    }
    
    .top-badge {
      margin-top: 4px;
      padding: 2px 8px;
      background: transparent;
      color: white;
      border-radius: 10px;
      font-size: 10px;
      font-weight: 600;
    }
  }
  
  // 统计信息样式
  .stats-info {
    display: flex;
    gap: 16px;
    
    .stat-item {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 4px 8px;
      background: transparent;
      border-radius: 8px;
      font-size: 12px;
      color: #667eea;
      
      .el-icon {
        font-size: 14px;
      }
      
      .stat-number {
        font-weight: 600;
      }
    }
  }
  
  // 时间信息样式
  .time-info {
    .time-item {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 4px;
      font-size: 12px;
      color: #666;
      
      .el-icon {
        font-size: 14px;
        color: #999;
      }
    }
  }
  
  // 操作按钮样式
  .table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    
    .action-btn {
      padding: 6px 12px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      transition: all 0.3s ease;
      
      &.view-btn {
        background: transparent;
        border: none;
        color: #333;
        
        &:hover {
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(168, 237, 234, 0.4);
        }
      }
      
      &.edit-btn {
        background: transparent;
        border: none;
        color: white;
        
        &:hover {
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
        }
      }
      
      &.delete-btn {
        background: transparent;
        border: none;
        color: white;
        
        &:hover {
          transform: translateY(-2px);
          box-shadow: 0 6px 20px rgba(250, 112, 154, 0.4);
        }
      }
    }
  }
}

// 帖子详情样式
.post-detail {
   padding: 20px 0;
}

.post-header {
   border-bottom: 1px solid transparent;
   padding-bottom: 15px;
   margin-bottom: 20px;
}

.post-header h2 {
   margin: 0 0 10px 0;
   color: #333;
}

.post-meta {
   color: #666;
   font-size: 14px;
}

.post-meta span {
   margin-right: 15px;
}

.post-content {
   margin-bottom: 30px;
   line-height: 1.6;
}

.comment-section {
   border-top: 1px solid transparent;
   padding-top: 20px;
}

.comment-section h3 {
   margin-bottom: 15px;
   color: #333;
}

.comment-form {
   margin-bottom: 20px;
}

.comment-list {
   max-height: 400px;
   overflow-y: auto;
}

.comment-item {
   border-bottom: 1px solid transparent;
   padding: 15px 0;
}

.comment-header {
   margin-bottom: 8px;
}

.comment-author {
   font-weight: bold;
   color: #333;
   margin-right: 10px;
}

.comment-time {
   color: #999;
   font-size: 12px;
}

.comment-content {
   margin-bottom: 8px;
   line-height: 1.5;
}

.comment-actions {
   display: flex;
   gap: 15px;
}

// 响应式设计
@media (max-width: 768px) {
  .page-header {
    .header-content {
      flex-direction: column;
      gap: 16px;
      
      .header-stats {
        width: 100%;
        justify-content: space-around;
      }
    }
  }
  
  .action-buttons {
    justify-content: center;
  }
  
  .table-actions {
    flex-direction: column;
    
    .action-btn {
      width: 100%;
      justify-content: center;
    }
  }
}
</style>
